<?php
session_start();

require_once("database.include.php");

	$username=$_GET["username"];
				
    $sql = "SELECT `name`, `description` FROM `group` 
    WHERE `name` IN (SELECT `group_name` FROM `group_user` WHERE `user_name` = '" . $username . "')
    ORDER BY `name`";
    
    echo "<br>Invite user to a group.<br>";
    echo "Group:<select id='selinviteGroup'>";
    
    foreach ($conn->query($sql) as $row) {
    	print "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";
    }
    echo "</select><br>";
    echo "User: <input type='text' id='inviteUser'><br>";
    //echo "Encrypted Group Private Key: <input type='text' id='encGroupPrivKey'><br>";
    echo "<button onclick='ajaxInviteUser()'>Invite User</button>";
?>
    